#ifndef _TEST_CURL_H
#define _TEST_CURL_H
#include <sys/types.h>
#include <stdio.h>
#include "url_info.h"



#define DISK_MAGIC 0xa8f43b0e
struct disk_fmt {
	u_int32_t ver; /* must be set to 1 */
	u_int32_t filelen;
	u_int32_t headlen;
	u_int32_t magic; /* validation check */
};


#define BLK_F_200 1
#define BLK_F_302 1<<1
#define BLK_F_LEN 1<<2
#define BLK_F_TRUNK 1<<3
struct curlblock
{
	int sock;
	int flag;
	FILE *f;
	struct url_info *url;
	struct disk_fmt *disk;
};


struct dl_task {
	struct url_info *url_info;
	struct disk_fmt *disk;
	unsigned int from, to; /* @to point to the byte after the content, where @from start from zero */
	unsigned int total; /* 0 mean not determined */
	int use206; /* if use partial content response */
};


void flv_send_data(int fd, int sock, struct dl_task *dl_task, struct stat *st);

void media_send_data(int fd, int sock, struct dl_task *dl_task, struct stat *st, char *ext);
#endif
